<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		function quickSort(arr) {
			if (arr.length < 2) {
				return arr
			}
			const {length} = arr
			// 基准
			let base = arr[0]
			let minArr = arr.slice(1).filter(i => i <= base)
			let maxArr = arr.slice(1).filter(i => i > base)
			return quickSort(minArr).concat(base).concat(quickSort(maxArr))
		}
		quickSort([3,6,4,5,2,1])

	</script>
</body>

</html>